<template>
    <div id="F">
        <p class="table" :style="uid+1==InitDV.index?'color:#fff;background:#7e591b':''">{{rest.tatel}}<span ></span></p>
        <transition>
            <ul id="ul">
                <a href="javascript:;" v-for="(tiem,kss) in rest.table" :key=kss ><li :style="uid+1==InitDV.index&&kss+1===InitDV.data.GT?'background: #b9a17a;color: #4c371a;':false"  @click="tabGames(tiem.src)">
                    <p>{{tiem.tatel}}<i></i></p>
                    <!-- 选中图标 -->
                    <!-- <span v-show="uid===select.key&&k===select.index"></span> -->
                    <span :class="{'spanShow':uid+1==InitDV.index&&kss+1===InitDV.data.GT}"></span>
                </li></a>
            </ul>			
        </transition>
    </div>
</template>
<script>
export default {
    name:"dv",
    props:['rest',"uid"],
	data(){
		return {
			index:0,
		}
	},
	computed:{
		InitDV(){
			return {data:this.$store.getters.Init,index:this.$route.params.m};
		}
	},
	methods:{
		tabGames(Msg){
			window.AudioObj.Play(["tabNav"])
			let oldListName=this.$store.getters.ListStatusName;
			let i;
			let j;
			if(Msg.HallNumber==1||Msg.HallNumber==2){
				window.userSocket.uSend('{"ActType":3,"ConnectionId":"","Content":{"HallNumber": '+Msg.HallNumber+'},"ErrorCode":10000,"RandCode":"' + RandCode + '","UId":"' + UserId + '","GT": '+Msg.GT+' }')
				for(i in oldListName){
					window.ioSocket.emit('unsubscribe',oldListName[i]);
				}
				this.$store.commit("clearRadisnName");
				window.ioSocket.emit('subscribe','RoomListInRoom'+Msg.HallNumber+Msg.GT);
				// 判断导航大厅位置
				if(Msg.HallNumber==1){
					for( j= 32; j >= 1; j--){
						window.ioSocket.emit('subscribe',"RoomBroadCastAfterTZ"+j);
					}
				}
				else{
					for(j = 61; j >= 33; j--){
						window.ioSocket.emit('subscribe',"RoomBroadCastAfterTZ"+j);
					}
				}				
			}
			else if(Msg.HallNumber==3){
				window.userSocket.uSend('{"RandCode":"'+RandCode+'","ConnectionId":"","ActType":30,"UId":"'+UserId+'","ErrorCode":10000,"Content":{"OldTids":"","NewTids":"7-2-10-4"}}')
				for(i in oldListName){
					window.ioSocket.emit('unsubscribe',oldListName[i]);
				}
				this.$store.commit("clearRadisnName");
				window.ioSocket.emit('subscribe','RoomListInRoom');
				window.ioSocket.emit('subscribe','RoomListInRoom'+Msg.HallNumber+Msg.GT);
			}
			else if(Msg.HallNumber==4){
				window.userSocket.uSend('{"ActType":3,"ConnectionId":"","Content":{"HallNumber": '+Msg.HallNumber+'},"ErrorCode":10000,"RandCode":"' + RandCode + '","UId":"' + UserId + '","GT": '+Msg.GT+',"Room_attribute":2}')
			}
			this.$router.replace({name:"home",params:{m:Msg.HallNumber}});
		}
	}
}
</script>
